﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShSoft.Infrastructure.EntityBase;

namespace WarehouseSystem.Domain.Entities
{
    /// <summary>
    /// 商品信息
    /// </summary>
    public class Product : AggregateRootEntity
    {
        #region  # 构造器

        #region 01.无参构造器
        /// <summary>
        /// 无参构造器
        /// </summary>
        protected Product()
        {

        }

        #endregion

        #region 02.创建商品构造器

        public Product(string productName):this()
        {
            #region # 验证参数

            if (string.IsNullOrWhiteSpace(productName))
            {
                throw new ArgumentNullException("productName", @"商品名称不能为空！");
            }

            #endregion

            base.Name = productName;

            //初始化关键字
            this.InitKeywords();
        }

        #endregion

        #endregion

        #region # 属性


        #endregion

        #region 方法

        //public

        #region 获取商品信息 —— 

        

        #endregion

        //private

        #region 初始化关键字 —— void InitKeywords()
        /// <summary>
        /// 初始化关键字
        /// </summary>
        private void InitKeywords()
        {
            StringBuilder keywordsBuilder = new StringBuilder();
            keywordsBuilder.Append(base.Number);
            keywordsBuilder.Append(base.Name);

            base.SetKeywords(keywordsBuilder.ToString());
        }
        #endregion

        #endregion
    }
}
